﻿@using WineStore.Extends;
@using PagedList.Mvc;
@using PagedList;
@model PagedList.IPagedList<WineStore.Models.Banner>
@{
    ViewBag.Title = "ShowBanner";
    Layout = "~/Views/Shared/AdminLayout.cshtml";
}
@section Styles
{
    <!--Sử dụng cho paging-->
    <link href="../../Content/PagedList.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        td {
            text-align: center;
            vertical-align: middle;
        }
    </style>
}
@section Scripts
{
    <!--Sử dụng cho row hover-->
    <script type="text/javascript">
        $(document).ready(function () {
            $("tr").not(':first').hover(function () {
                $(this).css("background", "#F0FFFF");
            }, function () {
                $(this).css("background", "");
            }
            );
        });
    </script>

}
<!-- Table (TABLE) -->
@*@if (Session["Admin"] != null)
{
    *@<h3 class="tit">Management Banner
    </h3>
    <div>
        <h4>The current time is: @ViewBag.DateTime</h4>
    </div>
    @using (Html.BeginForm())
    {
    <table border="1" style="width: 100%">
        <tr>
            <th>Banner Title (English)
            </th>
            <th>Banner Title (German)
            </th>
            <th>Display Order
            </th>
            <th>Image
            </th>
            <th>Event
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(banner => item.BannerTitle_EN)
                </td>
                <td>
                    @Html.DisplayFor(banner => item.BannerTitle_GER)
                </td>
                <td>
                    @Html.DisplayFor(banner => item.BannerPosition)
                </td>
                <td>
                    @Html.ImageFor(banner => "../../Content/Images/Banners/" + item.BannerImage, new { width = "450px", height = "400px", alt = "some alt text" })
                </td>
                <td>
                    @Html.ActionLink("Edit", "EditBanner", new { id = item.BannerId })
                    @Html.ActionLink("Delete", "DeleteBanner", new { id = item.BannerId })
                </td>
            </tr>
        }
        <tr>
            <td colspan="5" align="right" style="text-align: right; vertical-align: bottom;">
                @Html.ActionLink("Create Banner", "CreateBanner")
            </td>
        </tr>
    </table>
    <!--Paging-->
    @Html.PagedListPager(Model, page => Url.Action("ShowBanner", new { page = page }), (PagedListRenderOptions)ViewBag.Pro)
    }
@*}
else
{
    Response.Redirect("~/Admin/LogOn/");
}*@